﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using OpenCvSharp;

namespace FinallyVideoCaptureTest.Assist
{
    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
    public struct PeopleCountModel:IDisposable
    {

        /// IplImage*
        public System.IntPtr pPreImage;

        /// IplImage*
        public System.IntPtr pPrePreImage;

        /// CvRect
        public CvRect Roi;

        /// CvSize->Anonymous_c0f27236_491c_417d_94ab_cfe37e62f091
        public CvSize PeopleSize;

        /// int
        public int iJump;

        /// int
        public int iFrameCount;

        /// int
        public int iInNum;

        /// int
        public int iOutNum;

        #region IDisposable Members

        public void Dispose()
        {
            
        }

        #endregion
    }

    public unsafe class AccessBaseTarget
    {
        const string DllName = "PeopleCountDll.dll";
        /// return type: PeopleCountModel*
        /// IplImage*:pImage
        [DllImport(DllName, EntryPoint = "InitPeoModel")]
        public static extern System.IntPtr InitPeoModel(IntPtr pImage, CvRect roi, CvSize PeopleSize, int iJump);
        //PeopleCountModel * InitPeoModel(IplImage *pImage)

        /// return type:void 
        /// pPeoCModel:*PeopleCountModel
        /// pImage:IplImage
        [DllImport(DllName, EntryPoint = "UpdatePeoModel")]
        public static extern void UpdatePeoModel(ref PeopleCountModel pPeoCModel, IntPtr pImage);

        /// return type:void 
        /// pPeoCModel:*PeopleCountModel
        [DllImport(DllName, EntryPoint = "ReleasePeoModel")]
        public static extern void ReleasePeoModel(ref PeopleCountModel pPeoCModel);

        [DllImport(DllName, EntryPoint = "ReleasePeoModel")]
        public static extern void ReleasePeoModel(IntPtr pPeoCModel);

    }
}
